<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
            需求：
                判断数组当中的元素是否都大于等于10
         */
        //  实现方式一
        const array1 = [11, 30, 39, 29, 12, 13];

        function myEvery(arr){
            for(const element of arr){
                if(element < 10){
                    return false;
                }
            }
            return true;
        }

        console.log(myEvery(array1));
        // 实现方法二
        function isBigEnough(element) {
            return element >= 10;
        }
        function myEvery2(arr) {
            for(const element of array1) {
                if(!isBigEnough(element)) {
                    return false;
                }
            }
            return true;
        }
        console.log(myEvery2(array1));
        // 实现方法三
        const isThreshold = (currentValue) => currentValue>=10;
        console.log(array1.every(isThreshold)); 
    </script>
</head>
<body>
    
</body>
</html>